/*
 * @Author: M_xiaohan
 * @Last Modified time: 2018-05-01 14:11:47
 */
import React from 'react';
import {
  Grid,
  WingBlank,
  WhiteSpace,
  // SearchBar,
} from 'antd-mobile';
import {
  connect,
} from 'dva';
import {
  routerRedux,
} from 'dva/router';

class ClassificationCard extends React.Component {
  componentDidMount() {
    this.props.dispatch({
      type: 'internaltradetype/fetchInternaltradetypeList',
      payload: {
        pageNum: 0,
      },
    });
  }
  render() {
    return (
      <div>
        <WhiteSpace />
        {/* <SearchBar placeholder="请输入详细信息" /> */}
        <WingBlank>
          <Grid
            data={this.props.InternaltradetypeList}
            columnNum={3}
            renderItem={dataItem => (
              <div >
                <img src="./src/assets/img/food.png" style={{ width: '64px', height: '64px' }} alt={dataItem.internalType} />
                <div style={{ color: '#888', fontSize: '14px' }}>
                  <span>{dataItem.internalType}</span>
                </div>
              </div>
            )}
            onClick={(dataItem) => {
              this.props.dispatch(routerRedux.push({
                pathname: '/internaltradetypelist',
                query: dataItem,
            }));
            }}
          />
        </WingBlank>
        <WhiteSpace />

      </div>
    );
  }
}


export default connect(({
  internaltradetype,
}) => ({
  InternaltradetypeList: internaltradetype.InternaltradetypeList,
}))(ClassificationCard);
